home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tclX-6.4 / help / strings / regsub < prev    next >
Encoding:
Text File  |  1992-12-17  |  2.3 KB  |  34 lines

  1.           regsub ?-all? ?-nocase? exp string subSpec varName
  2.                This command matches the regular expression exp against
  3.                string using the rules described in REGULAR EXPRESSIONS
  4.                above.   If there is no match, then the command returns
  5.                0 and does nothing else.  If there is a match, then the
  6.                command  returns  1  and  also  copies  string  to  the
  7.                variable whose name is given by varName.  When  copying
  8.                string,  the  portion  of  string  that  matched exp is
  9.                replaced with subSpec.  If subSpec contains a ``&''  or
  10.                ``\0'',  then  it  is replaced in the substitution with
  11.                the portion of string that  matched  exp.   If  subSpec
  12.                contains  a ``\n'', where n is a digit between 1 and 9,
  13.                then it  is  replaced  in  the  substitution  with  the
  14.                portion  of  string that matched the n-th parenthesized
  15.                subexpression of exp.  Additional  backslashes  may  be
  16.                used  in  subSpec  to prevent special interpretation of
  17.                ``&'' or ``\0'' or ``\n'' or  backslash.   The  use  of
  18.                backslashes in subSpec tends to interact badly with the
  19.                Tcl parser's use  of  backslashes,  so  it's  generally
  20.                safest  to  enclose  subSpec  in  braces if it includes
  21.                backslashes.  If the -all argument is  specified,  then
  22.                all  ranges  in  string  that  match  exp are found and
  23.                substitution is performed for  each  of  these  ranges;
  24.                otherwise  only  the  first matching range is found and
  25.                substituted.  If -all  is  specified,  then  ``&''  and
  26.                ``\n''  sequences  are  handled  for  each substitution
  27.                using the information from the corresponding match.  If
  28.                the  -nocase  argument  is  specified,  then upper-case
  29.                characters in string are converted to lower-case before
  30.                matching against exp;  however, substitutions specified
  31.                by subSpec use the original unconverted form of string.
  32.                The  -all  and  -nocase  arguments  must  be  specified
  33.                exactly:  no abbreviations are permitted.
  34.